package com.hotelManagerSystem.mapper;

import com.hotelManagerSystem.model.Room;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Cynthia
 * @since 2021-12-22
 */
public interface RoomMapper extends BaseMapper<Room> {

    @Update("update room set room_order_state=-1,room_clean_state=#{roomCleanState} where room_id=#{roomId}")
    int updateStateById(Integer roomId,int roomCleanState);

    @Update("update room set room_order_state=0,room_clean_state=1 where room_id=#{roomId}")
    int updateStateByIdClean(Integer roomId);

    @Select("select * from room where room_clean_state=#{roomOrderState}")
    List<Room> queryInfoByRoomOrderState(Integer roomOrderState);
}
